#ifndef TESTBASE_H
#define TESTBASE_H
#include <iostream>
#include <cstring>
#include <thread>
#include <mutex>
#include <atomic>
#include <memory>
#include <sys/fcntl.h>
using std::cin;
using std::cout;
using std::endl;

inline int setNonBlocking(int fd) {
    int flags = fcntl(fd, F_GETFL, 0);
    if (flags == -1) return -1;
    flags |= O_NONBLOCK;
    if (fcntl(fd, F_SETFL, flags) == -1) return -1;
    return 0;
}

class TestBase {
public:
    TestBase(int argc=0, char** argv=nullptr) :argc_(argc), argv_(const_cast<const char**>(argv)) { }
    virtual ~TestBase() = default;
    virtual void test() = 0;

protected:
    const int argc_;
    const char ** argv_;
};

#endif // TESTBASE_H
